<template>
	<view class="">
		
		<view v-if="!video_show" class="more_scene" :style="{'margin-top': windowHeight +'px'}">
			<view class="search">
				<image class="ico_ss" src="../../static/img/ico_ss.png" mode="widthFix"></image>
				<input class="input_ss" v-model="liveName" type="text" placeholder="请输入推氪号或场景关键词" @confirm="getRecommendLivesList" />
				<button class="btn" @click="getRecommendLivesList">查找</button>
			</view>
			<view class="title">
				推荐场景
			</view>
			<u-empty v-if="aigcRecommendLives.length == 0" mode="search" marginTop="200rpx" icon="/static/img/ico_none.png" ></u-empty>
			<view v-else class="list">
				<view class="item" v-for="(item,index) in aigcRecommendLives" @click="clickRecommendLive(item.id)" :key="index">
					<image class="ph" :src="item.file" mode="aspectFill"></image>
					<view class="info">
						<view class="name">
							{{item.name}}
						</view>
						<view class="tag">
							{{item.sub_title}}
						</view>
					</view>
				</view>
			</view>
			
		</view>
		
	</view>
</template>

<script>

	export default {
		data() {
			return {
				isFocus: false,
				isVoice: 0,
				showExpend:false,
				keyInput: null,
				showPopup: false,
				keyText: '',
				focusKey: false,
				voicePath: '',
				willStop: false,
				voiceText: '按住 说话',
				isVoiceClass: false,
				initPoint: {
					identifier: 0,
					Y: 0
				},
				voiceTips: '手指上滑取消发送',
				keyboardInfo:{},
				
				liveName: '',
				aigcRecommendLives:[],
				liveId:'',
				isPrivate:0,
				liveSubTitle:'',
				liveFile:'',
				token: '',
				userId: 0,
				
				oldLiveVideos: [],
				bgLiveVideos: [],
				liveVideos: [],
				liveVideoIndex: 0,
				
				liveWords: [],
				liveWordIndex: null,
				videoUrl:'',
				videoImg:'',
				userInfo:{},
				anchorInfo: {},
				isLogin: false,
				anchorId:'',
				commonLiveId: '',
				chattingData: [],
				isLike: false,
				welcome:'',
				isOneself: false,
				maxWidth: 200,
				timeoutId: null,
				historys: [],
				
				plugin: null,
				managerWechat: null,
				
				scrollTop: 10000,
				old: {
					scrollTop: 0
				},
				
				videoListData: [],
				isCoverPh: true,
				aiName: '',
				aiAvatar: '',
				muted: false,
				isWordsPlay: false,
				shareInfo:{},
				can_watch: true,
				can_share: true,
				is_lock:true,
				touchStartTime: 0,
				windowHeight: 0,
				video_show: false,
				default_img: 'http://smsaas.oss-cn-hangzhou.aliyuncs.com/video/img/1732866459446.jpg',
				page: 1,
				noMoreData: false,
			}
		},
		onLoad(opt) {
			const that = this
			
			uni.$on('clickliveWords',res=>{
				console.log(res.item, '-----------------------------');
				console.log(res.index, '-----------------------------');
				that.clickliveWords(res.item, res.index);
			})
			
			uni.getSystemInfo({
				success: function (info) {
					console.log('屏幕的高度：' + info.windowHeight);
					console.log('屏幕的宽度：' + info.windowWidth);
					that.windowHeight = parseInt(info.windowHeight-(info.windowHeight*0.9))
				}
			});
			
			this.getRecommendLivesList()
			
		},
		onShow() {
			
		},
		
/* 		onReachBottom: function() {
			if (this.noMoreData) {
				return
			} else {
				this.getRecommendLivesList()
			}
		}, */
		methods: {
			closeExpend() {
			  this.showExpend = false
			  // console.log('close');
			},
			
			
			// 点击推荐场景
			clickRecommendLive(id){
				uni.reLaunch({
					url: "/pages/index/index?liveId=" + id
				})
				/* console.log('click----', id)
				this.video_show = true
				innerAudioContext.stop();
				this.chattingData = []
				// this.liveVideoIndex = 0
				// this.liveWordIndex = null
				// this.liveVideos = []
				this.historys = []
				this.liveId = id
				this.getAigcLiveVideos()
				this.getAigcLiveWords()
				this.speedViewAdd({live_id:this.liveId})
				this.getLivesConfigInfo()
				setTimeout(() => {
					this.showPopup = false
				}, 500); */
			},
			
			// 推荐场景
			getRecommendLivesList(){
				uni.$u.http.get('/api/aigc_recommend_lives_list?from=miniprogram&search='+this.liveName).then(res => {
					if(res.data && res.data.data){
						console.log('推荐场景-----',res);
						this.aigcRecommendLives = res.data.data;
					}
				}).catch(err => {
					console.log(err)
				})
			},
			
			
			
		}
	}
</script>

<style lang="scss" scoped>
	.upglide_tip {
		position: absolute;
		left: 50%;
		top: -200rpx;
		z-index: 99;
		width: 240rpx;
		height: 150rpx;
		margin-left: -120rpx;
		box-sizing: border-box;
		background: url('../../static/img/bg_7.png') no-repeat center center;
		background-size: 100% 100%;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		box-sizing: border-box;
		padding-bottom: 14rpx;

		.ico {
			display: block;
			width: 36rpx;
			margin-top: 20rpx;
		}

		text {
			font-size: 26rpx;
			font-weight: 500;
			line-height: 30rpx;
			color: #3D3D3D;
		}
	}

	.sounding {
		position: absolute;
		left: 0;
		bottom: 0;
		right: 0;
		width: 100%;
		z-index: 99;

		.bg_img {
			display: block;
			width: 100%;
		}

		.sounding_item {
			position: absolute;
			left: 0;
			right: 0;
			top: 0;
			bottom: 40rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: column;

			.text {
				font-size: 26rpx;
				font-weight: 500;
				line-height: 30rpx;
				padding-bottom: 35rpx;
			}

			.name {
				font-size: 20rpx;
				font-weight: 500;
				line-height: 30rpx;
				margin-top: 12rpx;
			}
		}

	}

	.keyboard {
		position: fixed;
		left: 0;
		bottom: 0;
		right: 0;
		z-index: 9999;
		background: #000;
		padding: 0 20rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		transition: all 0.25;
		.ico {
			flex-shrink: 0;
		}

		.key_input {
			width: 100%;
			height: 56rpx;
			border-radius: 10rpx;
			background: #1F1F1F;
			box-sizing: border-box;
			padding: 0 20rpx;
			font-size: 26rpx;
			margin: 20rpx 15rpx;
		}
	}
	
	.text-box{
		position: fixed;
		left: 40rpx;
		bottom: 405rpx;
		z-index: 9;
		min-height: 160rpx;
		max-height: 256rpx;
		border-radius: 35rpx;
		padding-right: 40rpx;
		text-align: justify;
		align-items: center;
		overflow: hidden;
	}
	.welcome_box{
		min-height: 70rpx;
		min-width: 20rpx;
	}
	.welcome_ques {
		min-height: 70rpx;
		border-radius: 35rpx;
		background: linear-gradient(90deg, rgba(0, 0, 0, 0.5) 53%, rgba(0, 0, 0, 0) 100%);
		align-items: center;
		font-size: 26rpx;
		font-weight: 500;
		line-height: 44rpx;
		text-align: justify;
		color: #fff;
		padding: 15rpx 25rpx;
		box-sizing: border-box;

		text {
			color: #AFAFAF;
			padding-right: 10rpx;
		}
	}
	
	.subtitle_ques{
		margin-top: 20rpx;
		min-height: 70rpx;
		max-height: 156rpx;
		border-radius: 35rpx;
		background: rgba(0, 0, 0, 0.4);
		font-size: 26rpx;
		font-weight: 500;
		line-height: 44rpx;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		overflow: hidden;
		text-overflow: ellipsis;
		-webkit-line-clamp: 3;
		color: #fff;
		padding: 15rpx 25rpx;
		box-sizing: border-box;
		
		text {
			color: #AFAFAF;
			padding-right: 10rpx;
		}
	}

	.more_scene {
		width: 100%;
		height: 100vh;
		overflow-y: auto;
		margin-top: 80rpx;
		.search {
			display: flex;
			align-items: center;
			width: 660rpx;
			height: 70rpx;
			border-radius: 35px;
			background: #1F1F1F;
			margin: 0 0 0 40rpx;
			padding: 0 10rpx 0 15rpx;
			box-sizing: border-box;
			border: 1rpx solid #999;

			.ico_ss {
				flex-shrink: 0;
				width: 36rpx;
				height: 36rpx;
				margin-right: 10rpx;
			}

			.input_ss {
				width: 100%;
				color: #fff;
				font-size: 22rpx;
				font-weight: normal;
				line-height: 32rpx;
			}

			.btn {
				flex-shrink: 0;
				height: 54rpx;
				border-radius: 30rpx;
				background: #F9BE01;
				font-size: 22rpx;
				font-weight: 500;
				line-height: 54rpx;
				text-align: center;
				color: #292D32;
			}
		}

		.title {
			font-size: 26rpx;
			font-weight: 600;
			line-height: 40rpx;
			color: #FFFFFF;
			padding: 40rpx 40rpx 0;
		}

		.list {
			display: flex;
			flex-wrap: wrap; /* 允许换行 */
			justify-content: flex-start; /* space-between子项间隔均匀分布 */
			padding-bottom: 80rpx;
			margin: 0 30rpx;
			overflow-y: scroll;
			.item {
				flex: 0 0 auto; /* 不伸缩，固定宽度 */
				width: 30%; /* 每行三个 */
				position: relative;
				margin: 30rpx 10rpx 10rpx 10rpx;
				/* margin-left: 30rpx; */
				background: #1F1F1F;
				border-radius: 10rpx;

				.info {
					padding: 10rpx 15rpx;

					.name {
						font-size: 22rpx;
						font-weight: normal;
						line-height: 32rpx;
						text-align: justify;
						color: #FFFFFF;
						height: 32rpx;
						overflow: hidden;
					}

					.tag {
						font-size: 18rpx;
						font-weight: normal;
						line-height: 26rpx;
						text-align: justify;
						color: #999999;
						height: 26rpx;
						overflow: hidden;
					}
				}

				.lock {
					position: absolute;
					left: 0;
					right: 0;
					top: 0;
					bottom: 0;
					z-index: 9;
					display: flex;
					align-items: center;
					justify-content: center;

					.ico_8 {
						width: 36rpx;
					}
				}

				.ph {
					display: block;
					width: 100%;
					height: 320rpx;
					border-radius: 10rpx 10rpx 0 0;
				}

			}
		}
	}

	.chatting {
		position: fixed;
		left: 0;
		top: 200rpx;
		right: 0;
		width: 670rpx;
		height: 560rpx;
		margin: 0 auto;
		border: 1px solid #F9BE01;
		border-radius: 30rpx;
		padding: 0 25rpx;
		box-sizing: border-box;
		background: rgba(0, 0, 0, 0.5);
		background-size: 100% auto;
		z-index: 9999;
		overflow: hidden;
		.scroll-Y{
			height: 560rpx;
		}
		.bg_img {
			width: 100%;
			position: absolute;
			left: 0;
			bottom: 0;
			right: 0;
			z-index: -1;
		}

		.item {
			display: flex;
			padding: 15rpx 0;
			align-items: self-start;
			justify-content: space-between;

			&.row_reverse {
				flex-direction: row-reverse;

				.text-right {
					text-align: right;
					padding-right: 15rpx;
					padding-left: 50rpx;
				}
			}

			.ph {
				flex-shrink: 0;
				width: 54rpx;
				height: 54rpx;
				border-radius: 50%;
			}

			.text-left {
				width: 100%;
				font-size: 26rpx;
				font-weight: 500;
				line-height: 44rpx;
				text-align: justify;
				color: #cecaca;
				padding: 5rpx 0;
				padding-left: 15rpx;
				padding-right: 70rpx;
				text {
					color: #AFAFAF;
				}
			}
			
			.text-right {
				width: 100%;
				font-size: 26rpx;
				font-weight: 500;
				line-height: 44rpx;
				text-align: justify;
				color: #FFFFFF;
				padding: 5rpx 0;
				padding-left: 15rpx;
				padding-right: 70rpx;
				text {
					color: #AFAFAF;
				}
			}
		}
	}

	.voice {
		position: fixed;
		left: 0;
		bottom: 0;
		right: 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 40rpx 60rpx;

		.btn_big {
			width: 100%;
			height: 90rpx;
			border-radius: 40px;
			background: rgba(0, 0, 0, 0.6);
			display: flex;
			align-items: center;
			justify-content: center;

			.text {
				font-size: 26rpx;
				font-weight: 500;
				line-height: 30rpx;
				color: #FFFFFF;
				text-shadow: 0px 2rpx 4rpx rgba(0, 0, 0, 0.3);
				padding-left: 8rpx;
			}

			&.hover {
				background: rgba(249, 190, 1, 0.4);
			}
		}
		.btn-left {
			flex-shrink: 0;
			width: 90rpx;
			height: 90rpx;
			background: rgba(0, 0, 0, 0.6);
			border-radius: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			margin-right: 30rpx;
		}
		
		.btn-right {
			flex-shrink: 0;
			width: 90rpx;
			height: 90rpx;
			background: rgba(0, 0, 0, 0.6);
			border-radius: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			margin-left: 30rpx;
		}
		.btn-top-right{
		    position: fixed;
		    top: 200rpx;
		    width: 60rpx;
		    right: 40rpx;
		    height: 60rpx;
			background: rgba(0, 0, 0, 0.1);
			border-radius: 50%;
			align-items: center;
			display: flex;
			justify-content: center;
		}

		.ico_13 {
			width: 46rpx;
			height: 46rpx;
		}

		.ico_14 {
			width: 40rpx;
			height: 40rpx;
		}

		.ico_15 {
			width: 40rpx;
			height: 40rpx;
		}
		.ico_vioce {
			width: 30rpx;
			height: 30rpx;
		}
	}

	.intellect {
		position: fixed;
		left: 20rpx;
		right: 20rpx;
		bottom: 100rpx;
		//background: url('../../static/img/bg_1.png') no-repeat center top;
		background-size: 100% auto;
		height: 300rpx;

		.list {
			display: flex;
			align-items: flex-start;
			justify-content: flex-start;
			align-content: flex-start;
			flex-wrap: wrap;
			padding: 10rpx 15rpx;
			height: 200rpx;
			overflow-y: auto;
			.item {
				line-height: 56rpx;
				border-radius: 20rpx;
				background: rgba(0, 0, 0, 0.6);
				box-sizing: border-box;
				color: #fff;
				font-size: 24rpx;
				font-weight: bold;
				padding: 5rpx 25rpx;
				margin: 10rpx 10rpx;

				&.hover {
					background: rgba(249, 190, 1, 0.3);
					text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.3);
				}
			}
			.ico_lock{
				margin-left: 10rpx;
				width: 24rpx;
				height: 24rpx;
				margin-bottom: -4rpx;
			}
		}

		.title {
			display: flex;
			align-items: center;
			justify-content: space-between;

			.ico_3 {
				width: 46rpx;
				height: 20rpx;
			}

			.ico_4 {
				width: 36rpx;
				height: 36rpx;
			}

			.ico_5 {
				width: 34rpx;
				height: 36rpx;
			}

			.name {
				width: 270rpx;
				color: #fff;
				display: flex;
				align-items: center;
				justify-content: space-between;
				box-sizing: border-box;
				padding-right: 40rpx;
				height: 68rpx;
				margin-top: 10rpx;

				.text {
					display: block;
					padding-left: 20rpx;
					font-size: 32rpx;
					font-weight: 500;
					line-height: 48rpx;
					text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2334);
					font-weight: bold;
				}
			}

			.btn {
				width: 167rpx;
				height: 68rpx;
				border-radius: 35rpx;
				background: rgba(0, 0, 0, 0.3);
				display: flex;
				align-items: center;
				justify-content: center;

				.text {
					display: block;
					color: #fff;
					padding-left: 10rpx;
					font-size: 28rpx;
					line-height: 30rpx;
				}
			}
		}
	}

	.home_header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		box-sizing: border-box;
		padding: 80rpx 230rpx 0 40rpx;

		.header_info {
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 70rpx;
			border-radius: 35rpx;
			background: rgba(0, 0, 0, 0.3);
			padding: 0 8rpx;
			margin-right: auto;

			.ph {
				flex-shrink: 0;
				display: block;
				width: 54rpx;
				height: 54rpx;
				border-radius: 50%;
				border: 4rpx solid #fff;
			}

			.name {
				color: #fff;
				font-size: 26rpx;
				line-height: 30rpx;
				padding: 0 10rpx;
				white-space: nowrap; /* 确保文本在一行内显示 */
				overflow: hidden; /* 隐藏溢出的内容 */
				text-overflow: ellipsis; /* 使用省略号表示溢出的文本 */
			}

			.btn {
				flex-shrink: 0;
				width: 78rpx;
				height: 54rpx;
				line-height: 54rpx;
				text-align: center;
				border-radius: 30rpx;
				background: #F9BE01;
				font-size: 22rpx;

				&.hover {
					width: 100rpx;
					color: #fff;
					background: #484848;
				}
			}
		}

		.header_more {
			flex-shrink: 0;
			margin: 0 20rpx;
			width: 70rpx;
			height: 70rpx;
			border-radius: 35rpx;
			background: rgba(0, 0, 0, 0.3);
			display: flex;
			align-items: center;
			justify-content: center;
			.name {
				color: #fff;
				font-size: 26rpx;
				line-height: 36rpx;
				margin-left: 10rpx;
			}
		}

		.header_my {
			flex-shrink: 0;
			width: 70rpx;
			height: 70rpx;
			border-radius: 35rpx;
			background: rgba(0, 0, 0, 0.3);
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.ico_1 {
			display: block;
			width: 36rpx;
			height: 36rpx;
		}

		.ico_2 {
			display: block;
			width: 40rpx;
			height: 40rpx;
		}
	}
	.video_ph{
		width: 100%;
		height: 100vh;
		position: fixed;
		z-index: 1;
		left:0;
		top:0;
		right: 0;
		bottom: 0;
		.img{
			display: block;
			width: 100%;
			height: 100vh;
			object-fit: cover;
		}
	}
	.home_video {
		width: 100%;
		height: 100vh;
		overflow: hidden;
		position: relative;
		
		.video_item{
			position: absolute;
			left:0;
			top:80rpx;
			right:0;
			bottom: 0;
			width: 100%;
			height: 100%;
			overflow: hidden;
		}
		.cover_ph {
			display: block;
			width: 100%;
			height: 100%;
		}
	}

	/* 语音音阶------------- */
	.prompt-loader {
		height: 30rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 20rpx;

		.em {
			flex-shrink: 0;
			display: block;
			background: #3D3D3D;
			width: 4rpx;
			height: 10rpx;
			margin: 2rpx;
			border-radius: 2rpx;
			animation: load 1.5s infinite ease-in-out;

			&:nth-child(1) {
				animation-delay: 1.2s;
			}

			&:nth-child(2) {
				animation-delay: 0.9s;
			}

			&:nth-child(3) {
				animation-delay: 0.6s;
			}

			&:nth-child(4) {
				animation-delay: 0.3s;
			}

			&:nth-child(5) {
				animation-delay: 0.6s;
			}

			&:nth-child(6) {
				animation-delay: 0.9s;
			}

			&:nth-child(7) {
				animation-delay: 1.2s;
			}
		}
	}


	@keyframes load {
		0% {
			height: 10rpx;
		}

		50% {
			height: 30rpx;
		}

		100% {
			height: 10rpx;
		}
	}
	
	.three-dots {
	  --size: 20px;
	  display: inline-block;
	  font-size: var(--size);
	  height: var(--size);
	  line-height: var(--size);
	  overflow: hidden;
	  vertical-align: bottom;
	}

	.three-dots::after {
	  display: inline-block;
	  white-space: pre;
	  content: '\A.\A..\A...';
	  animation: loop 2s steps(4) infinite;
	}

	@keyframes loop {
	  to {
		transform: translateY(calc(0px - var(--size) * 4));
	  }
	}
	
	.expend{
		width: 624rpx;
		text-align: center;
		padding: 20rpx;
		.title{
			font-size: 40rpx;
			color: #FFFFFF;
			line-height: 60rpx;
			padding:40rpx 0 30rpx;
		}
		.text{
			color: #A1A1A1;
			font-size: 24rpx;
			line-height: 36rpx;
		}
		.num{
			display: flex;
			align-items: center;
			justify-content: center;
			padding-top: 20rpx;
			.ico{
				flex-shrink: 0;
				width: 100rpx;
				height: 100rpx;
				margin-right: 10rpx;
			}
			text{
				display: block;
				font-size: 80rpx;
				color: #FFFFFF;
				line-height: 100rpx;
			}
		}
		
		.btn{
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: 40rpx;
			padding: 5rpx;
			.btn_item{
				width: 100%;
				height: 100rpx;
				line-height: 100rpx;
				border-radius: 100rpx;
				box-sizing: border-box;
				font-size: 30rpx;
				color: #000;
				margin-bottom: 20rpx;
				&.hover{
					background-color: #F9BE01;
				}
			}
		}
	}
</style>